
const tel=$("#tel")
const carnumber=$("#carnumber");
const carnumber1=$("#carnumber1");
const carnumber2=$("#carnumber2");
const carnumber3=$("#carnumber3");
$("#addl").click(function () {
  if(carnumber.val()===""){
      carnumber.attr("placeholder","车牌号不能为空!");
      return "";
  }
  //验证车牌号格式
  // if(carnumber.val()!==""){
  //     var pattern=/^[\u4e00-\u9fa5]{1}[A-Z]{1}[A-Z0-9]{5}$/;
  //     if(pattern.test(carnumber.val())==="false"){
  //         alert("车牌号格式错误")
  //        return "";
  // }
  // }
if(carnumber1.val()!=="无"&&carnumber2.val()!=="无"&&carnumber3.val()!=="无"){
    alert("车牌号已满，添加失败")
    return "";
}
    $.ajax({
        url: "/users/UserAddLicense",
        type: "post",
        data: {
            tel:tel.val(),
            carnumber:carnumber.val(),
            carnumber1:carnumber1.val(),
            carnumber2:carnumber2.val(),
            carnumber3:carnumber3.val()
        },
        success: function (Result) {
            alert(Result.msg);
            if(Result.code===20011){
                window.location.href="/users/useraddlicenseplate";
            }
            else {
                alert(Result.msg);
            }
        },
        error: function () {
            alert("添加车牌号失败,系统忙,请稍后重试!");
        }
    });
});